#!/usr/bin/python3
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM gcr.io/oss-fuzz-base/base-builder-python

# Install necessary packages
RUN apt-get update && \
    apt-get install -y wget build-essential checkinstall && \
    apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev \
                       libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

# Download and install Python 3.11
RUN cd /usr/src && \
    wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz && \
    tar xzf Python-3.11.0.tgz && \
    cd Python-3.11.0 && \
    ./configure --enable-optimizations && \
    make install && \
    ln --force -s /usr/local/bin/python3.11 /usr/local/bin/python3

# Install pip and Python dependencies
RUN python3 -m ensurepip && \
    python3 -m pip install --upgrade pip && \
    python3 -m pip install cython "atheris>=2.1.1" "pyinstaller==6.15.0" "coverage==6.3.2"

RUN git clone https://github.com/networkx/networkx networkx
RUN git clone --depth=1 https://github.com/prefuse/Prefuse prefuse
COPY *.sh *py $SRC/
WORKDIR $SRC/networkx
